﻿using Omabar.BLL;
using Omabar.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Omabar.CMS.Mobile
{
    public partial class Index : System.Web.UI.Page
    {
        protected List<SLIDER> tSliders;
        protected List<SLIDER> orginSliders;
        protected List<Tailor> tailors;
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    Slider_M_BLL sliderBLL = new Slider_M_BLL();

                    //原创
                    string orginSQL = "SELECT Top 5 SLIDER_ID,SLIDER_IMAGE,SLIDER_URL,SLIDER_DES,SLIDER_SORT,SLIDER_TYPE,SLIDER_BAK FROM SLIDER_M WHERE SLIDER_TYPE=1 order by SLIDER_SORT";
                    orginSliders = sliderBLL.GetModels(orginSQL);
                    if (orginSliders == null) orginSliders = new List<SLIDER>();
                    //T图
                    string tSQL = "SELECT Top 5 SLIDER_ID,SLIDER_IMAGE,SLIDER_URL,SLIDER_DES,SLIDER_SORT,SLIDER_TYPE,SLIDER_BAK FROM SLIDER_M WHERE SLIDER_TYPE=0 order by  SLIDER_SORT";
                    tSliders = sliderBLL.GetModels(tSQL);
                    if (tSliders == null) tSliders = new List<SLIDER>();
                    //定制师
                    Tailor_BLL tailor_BLL = new Tailor_BLL();
                    tailors = tailor_BLL.GetModels("select TOP 3 TAILOR_ID , TAILOR_NAME,TAILOR_INFO,TAILOR_SPECIALTY,TAILOR_CASE,TAILOR_QQ,TAILOR_PHONE,TAILOR_HEAD_IMG,TAILOR_HOT FROM TAILOR ORDER BY TAILOR_HOT DESC");
                    if (tailors == null) tailors = new List<Tailor>();
                }
            }
            catch (Exception ex)
            {
                Tom.Net.Log.LogManager.Error("Index页面错误", ex);
            }
        }
    }
}